package com.xyx.yfy_site_msg.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xyx.yfy_site_msg.system.entity.YfyCustomer;
import com.xyx.yfy_site_msg.system.entity.YfyDataEntity;
import com.xyx.yfy_site_msg.system.entity.YfyOther;
import com.xyx.yfy_site_msg.system.mapper.YfyCustomerMapper;
import com.xyx.yfy_site_msg.system.service.YfyCustomerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author xyx
 * @since 2020-11-17
 */
@Service
@Transactional
public class YfyCustomerServiceImpl extends ServiceImpl<YfyCustomerMapper, YfyCustomer> implements YfyCustomerService {

    @Override
    public String loadCustomerNameById(@Param("customerid")Integer customerid) {
        return this.getBaseMapper().loadCustomerNameById(customerid);
    }

    @Override
    public List<YfyDataEntity> loadAllCustomerOfProvince() {
        return this.getBaseMapper().loadAllCustomerOfProvince();
    }

    @Override
    public List<YfyDataEntity> loadCreate(@Param("month") String month) {
        return this.getBaseMapper().loadCreate(month);
    }

    @Override
    public List<YfyDataEntity> loadUpdate(@Param("month") String month) {
        return this.getBaseMapper().loadUpdate(month);
    }

    @Override
    public String loadCustomerTimeById(Integer id) {
        return this.baseMapper.loadCustomerTimeById(id);
    }

    @Override
    public List<YfyDataEntity> loadAllAddressOfCount() {
        return this.baseMapper.loadAllAddressOfCount();
    }

    @Override
    public List<YfyOther> loadOther() {
        return this.baseMapper.loadOther();
    }
    /*-----------------重写客户档案的crud方法切入缓存开始------------------*/

    /**
     * 翻页查询
     *
     * @param page         翻页对象
     * @param queryWrapper 实体对象封装操作类 {@link QueryWrapper}
     */
    @Override
    public <E extends IPage<YfyCustomer>> E page(E page, Wrapper<YfyCustomer> queryWrapper) {
        return getBaseMapper().selectPage(page, queryWrapper);
    }

    @Override
    public boolean updateById(YfyCustomer customer) {
        return super.updateById(customer);
    }

    @Override
    public boolean save(YfyCustomer customer) {
        return super.save(customer);
    }

    @Override
    public boolean removeById(Serializable id) {
        return super.removeById(id);
    }
    /*-----------------重写客户档案的crud方法切入缓存结束------------------*/
}
